package b2.scene.fight.skills
{
	import flash.utils.getDefinitionByName;
	public class SkillHelper
	{
		//冲锋
		public static const ASSAULT:int = 8;
		//连发
		public static const BURST:int = 802;
		//特殊子弹
		public static const SPECIAL_BULLET:int = 6;
		//主动防御武器
		public static const EFFECT_ADD:int = 7;
		//冰雪风暴
		public static const ICE_STORM:int = 9;
		//炮台转弯
		public static const TURN_ARROND:int = 11;
		//献祭
		public static const DEATH_PACT:int = 12;
		//隐身
		public static const INVISIBLE:int = 13;
		//自爆
		public static const EXPLOSIVE_SELF:int = 14;
		//冲撞
		public static const DURATION_AREAHARM:int = 15;
		//复活
		public static const RESURRECT:int = 16;
		//物理免疫
		public static const PHYSICAL_DEFENSE:int = 17;
		//魔法免疫
		public static const MAGIC_DEFENSE:int = 18;
		//闪现
		public static const BLINK:int = 19;
		//毁灭
		public static const DOOM:int = 20;
		//援助
		public static const AID:int = 21;
		//草丛隐身
		public static const JUNGLE_INVISIBLE:int = 22;
		//区域伤害
		public static const AREA_HARM:int = 201;
		//百鸟朝凤
		public static const BIRDS_TO_PHEONIX:int = 202;
		
		private var skills:Object;
		
		static private var instance:SkillHelper;
		
		public function SkillHelper()
		{
			//让程序编译
			var t1:AssaultSkill;
			var t2:EffectAddSkill;
			var t3:IceStorm;
			var t4:TurnArround;
			var t5:AreaHarm;
			var t6:DeathPact;
			var t7:Invisible;
			var t8:ExplosiveSelf;
			var t9:DurativeAreaHarm;
			var t10:Resurrect;
			var t11:Blink;
			var t12:Doom;
			var t13:Aid;
			var t14:BirdsToPheonix;
			
			skills = new Object();
			skills[ASSAULT] = getDefinitionByName("b2.scene.fight.skills.AssaultSkill");
			skills[EFFECT_ADD] = getDefinitionByName("b2.scene.fight.skills.EffectAddSkill");
			skills[ICE_STORM] = getDefinitionByName("b2.scene.fight.skills.IceStorm");
			skills[TURN_ARROND] = getDefinitionByName("b2.scene.fight.skills.TurnArround");
			skills[AREA_HARM] = getDefinitionByName("b2.scene.fight.skills.AreaHarm");
			skills[DEATH_PACT] = getDefinitionByName("b2.scene.fight.skills.DeathPact");
			skills[INVISIBLE] = getDefinitionByName("b2.scene.fight.skills.Invisible");
			skills[EXPLOSIVE_SELF] = getDefinitionByName("b2.scene.fight.skills.ExplosiveSelf");
			skills[DURATION_AREAHARM] = getDefinitionByName("b2.scene.fight.skills.DurativeAreaHarm");
			skills[RESURRECT] = getDefinitionByName("b2.scene.fight.skills.Resurrect");
			skills[BLINK] = getDefinitionByName("b2.scene.fight.skills.Blink");
			skills[DOOM] = getDefinitionByName("b2.scene.fight.skills.Doom");
			skills[AID] = getDefinitionByName("b2.scene.fight.skills.Aid");
			skills[BIRDS_TO_PHEONIX] = getDefinitionByName("b2.scene.fight.skills.BirdsToPheonix");
		}
		
		public static function getInstance():SkillHelper
		{
			if (!instance)
				instance = new SkillHelper();
			return instance;
		}
		
		public static function createSkill(tankid:int, tankSide:int, skillIndex:int, level:int, args:Object):BasicSkill
		{
			if (!instance)
				instance = new SkillHelper();
			var Skill:Class = instance.skills[skillIndex] as Class;
			if (!Skill)
				return null;
			return new Skill(tankid, tankSide, level, args) as BasicSkill;
		}
	}
}